package com.ftg.learn.mapper;

import com.ftg.learn.domain.DeptDomain;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 描述
 *
 * @author 布衣
 * @date 2024/7/29
 */
@Mapper
public interface DeptMapper {

    /**
     * 查询数据库
     * @param dname 部门名称
     * @return      部门表信息
     */
    List<DeptDomain> showAll(@Param("dname") String dname);

    @Insert("insert into dept(deptno,dname,loc) values(#{deptno},#{dname},#{loc})")
    int save(DeptDomain deptDomain);

    @Update("update dept set deptno=#{dept.deptno},dname=#{dept.dname},loc=#{dept.loc} where deptno=#{deptno}")
    int modify(@Param("deptno") Integer deptno,@Param("dept") DeptDomain deptDomain);

    @Delete("delete from dept where deptno = #{id}")
    int deleteById(@Param("id") Integer id);
}
